<?php $this->renderPartial('_tabs'); ?>

<div class="grid_16">
    <div class="admin-agency form">
		<?php
		$form = $this->beginWidget('CActiveForm', array(
			'id' => 'admin-agency-mls-form',
			'enableAjaxValidation' => false,
			'htmlOptions' => array(
				'enctype' => 'multipart/form-data',
			)
		));
		?>
        <div class="section">
			<div class="block">
				<h3>Search Settings</h3>
				<table class="form-table">
					<tr>
						<th scope="row" width="180">
							<label>Default Search Type</label>
						</th>
						<td>
							<?php
							echo CHtml::dropDownList('AgencySetting[MlsDefaultSearchType]', $agency->getSetting('MlsDefaultSearchType'), array(
								'basic' => 'Basic',
								'advanced' => 'Advanced',
							));
							?>
						</td>
					</tr>
					<tr>
						<th scope="row" width="180">
							<label>Default Property Type</label>
						</th>
						<td>
							<?php
							echo CHtml::dropDownList('AgencySetting[MlsDefaultSector]', $agency->getSetting('MlsDefaultSector'), CHtml::listData($sectors, 'id', 'name'));
							?>
						</td>
					</tr>
					<tr>
						<th scope="row" width="180">
							<label>Default Transaction Type</label>
						</th>
						<td>
							<?php
							echo CHtml::dropDownList('AgencySetting[MlsDefaultTransactionType]', $agency->getSetting('MlsDefaultTransactionType'), Property::getListingTypes());
							?>
						</td>
					</tr>
					<tr>
						<th scope="row" width="180">
							<label>Default Listing Category</label>
						</th>
						<td>
							<?php
							echo CHtml::dropDownList('AgencySetting[MlsDefaultListingCategory]', $agency->getSetting('MlsDefaultListingCategory'), array(
								'Adhoc' => 'Adhoc Listings',
								'Project Unit' => 'Project Listings',
								'All' => 'All Listings',
							));
							?>
						</td>
					</tr>
					<tr>
						<th scope="row" width="180">
							<label>Listing Duration</label>
						</th>
						<td>
							<label for="AgencySetting_MlsListingDuration">Expire MLS Listings after</label>
							<input id="AgencySetting_MlsListingDuration" type="text" name="AgencySetting[MlsListingDuration]" size="4" value="<?php echo $agency->getSetting('MlsListingDuration'); ?>" />&nbsp;days
							<label class="hint">(Leave blank for no expiry)</label>
						</td>
					</tr>
					<tr>
						<th scope="row" width="180">
							<label>Default Listing Image</label>
						</th>
						<td>
							<?php echo $form->fileField($agency, 'listing_defalut_image'); ?>
							<div id="listing-default-photo-preview">
								<img src="<?php echo $agency->listing_defalut_image; ?>" />
							</div>
						</td>
					</tr>
				</table>
			</div>
        </div>
		<table class="form-table">
			<th>
				<button type="submit" class="link-button green round_all no-margin">
					<span>Save Changes</span>
				</button>
			</th>
		</table>
		<?php $this->endWidget(); ?>
    </div>
</div>